import { createRouter, createWebHistory } from 'vue-router'
import indexView from '@/view/index/index.vue'
import cartView from '@/view/cart/cart.vue'
import ordersView from '@/view/orders/orders.vue'
import meView from '@/view/me/me.vue'
import loginView from '@/view/login/login.vue'
import rechargeRecordsView from '@/view/me/rechargeRecords.vue'
import registerView from '@/view/login/register.vue'
import couponView from '@/view/coupon/coupon.vue'
import couponCenter from '@/view/me/couponCenter.vue'
const router = createRouter({
  history: createWebHistory(),
  mode: 'history',
  routes: [
    {
      path: '/',
      name: 'index',
      component: indexView
    },
    {
      path: '/cart',
      name: 'cart',
      component: cartView
    },
    {
      path: '/orders',
      name: 'orders',
      component: ordersView
    },
    {
      path: '/me',
      name: 'me',
      component: meView
    },
    {
      path: '/me/login',
      name: 'login',
      component: loginView
    },
    {
      path: '/me/rechargeRecords',
      name: 'rechargeRecords',
      component: rechargeRecordsView
    },
    {
      path: '/register',
      name: 'register',
      component: registerView
    },
    {
    path: '/me/edit',
    name: 'MeEdit',
    component: () => import('@/view/me/edit.vue'),
    meta: { requiresAuth: true }
    },
     {
      path: '/coupon',
      name: 'coupon',
      component: couponView
    },
     {
      path: '/me/couponCenter',
      name: 'couponCenter',
      component: couponCenter
    }
  ]
})

export default router